package com.jackie.tongzhuang.Adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;

import com.jackie.tongzhuang.Classes.BaseClass;
import com.jackie.tongzhuang.Enums.Constants;
import com.jackie.tongzhuang.Models.FenQi;
import com.jackie.tongzhuang.Models.JinHuoDan;
import com.jackie.tongzhuang.R;

import java.util.List;

public class JinHuoDanSpinnerAdapter extends BaseAdapter {
    private Context context;
    private List<JinHuoDan> items;



    public JinHuoDanSpinnerAdapter(Context context, List<JinHuoDan> items) {
        this.context = context;
        this.items = items;
    }

    @Override
    public int getCount() {
        return items.size();
    }

    @Override
    public Object getItem(int position) {
        return items.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int i, View view, ViewGroup parent) {
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.control_jinhuodan_spinner, parent, false);
        }
        TextView t_rq = view.findViewById(R.id.jhd_spinner_rq);
        TextView t_je = view.findViewById(R.id.jhd_spinner_je);
        TextView t_mc = view.findViewById(R.id.jhd_spinner_mc);
        t_rq.setText(items.get(i).getJinHuoRiQi());
        t_je.setText("¥"+items.get(i).getJinHuoJinE());
        String lb = Constants.leiBie[items.get(i).getLeiBieId()];
        t_mc.setText(items.get(i).getGongHuoShang().getMingCheng() +"  "+ lb);


        return view;
    }
}
